package com.ruoyi.web.controller.system;

import java.util.List;

import com.ruoyi.common.core.domain.entity.BusinessLoginInfo;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.service.IBusinessLoginInfoService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 业务系统登录信息Controller
 * 
 * @author ess
 * @date 2021-10-18
 */
@RestController
@RequestMapping("/system/businLoginInfo")
public class BusinessLoginInfoController extends BaseController
{
    @Autowired
    private IBusinessLoginInfoService businessLoginInfoService;

    /**
     * 查询业务系统登录信息列表
     */
    @PreAuthorize("@ss.hasPermi('system:businLoginInfo:list')")
    @GetMapping("/list")
    public TableDataInfo list(BusinessLoginInfo businessLoginInfo)
    {
        startPage();
        List<BusinessLoginInfo> list = businessLoginInfoService.selectBusinessLoginInfoList(businessLoginInfo);
        return getDataTable(list);
    }

    /**
     * 导出业务系统登录信息列表
     */
    @PreAuthorize("@ss.hasPermi('system:businLoginInfo:export')")
    @Log(title = "业务系统登录信息", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(BusinessLoginInfo businessLoginInfo)
    {
        List<BusinessLoginInfo> list = businessLoginInfoService.selectBusinessLoginInfoList(businessLoginInfo);
        ExcelUtil<BusinessLoginInfo> util = new ExcelUtil<BusinessLoginInfo>(BusinessLoginInfo.class);
        return util.exportExcel(list, "业务系统登录信息数据");
    }

    /**
     * 获取业务系统登录信息详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:businLoginInfo:query')")
    @GetMapping(value = "/{businessLoginInfoId}")
    public AjaxResult getInfo(@PathVariable("businessLoginInfoId") String businessLoginInfoId)
    {
        return AjaxResult.success(businessLoginInfoService.selectBusinessLoginInfoByBusinessLoginInfoId(businessLoginInfoId));
    }

    /**
     * 新增业务系统登录信息
     */
    @PreAuthorize("@ss.hasPermi('system:businLoginInfo:add')")
    @Log(title = "业务系统登录信息", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BusinessLoginInfo businessLoginInfo)
    {
        return toAjax(businessLoginInfoService.insertBusinessLoginInfo(businessLoginInfo));
    }

    /**
     * 修改业务系统登录信息
     */
    @PreAuthorize("@ss.hasPermi('system:businLoginInfo:edit')")
    @Log(title = "业务系统登录信息", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BusinessLoginInfo businessLoginInfo)
    {
        return toAjax(businessLoginInfoService.updateBusinessLoginInfo(businessLoginInfo));
    }

    /**
     * 删除业务系统登录信息
     */
    @PreAuthorize("@ss.hasPermi('system:businLoginInfo:remove')")
    @Log(title = "业务系统登录信息", businessType = BusinessType.DELETE)
	@DeleteMapping("/{businessLoginInfoIds}")
    public AjaxResult remove(@PathVariable String[] businessLoginInfoIds)
    {
        return toAjax(businessLoginInfoService.deleteBusinessLoginInfoByBusinessLoginInfoIds(businessLoginInfoIds));
    }
}
